/****** Object:  Stored Procedure [dbo].spChiTietPhieuNhapSelectAllBySoPN Script Date: 6/12/2012 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[spChiTietPhieuNhapSelectAllBySoPN]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spChiTietPhieuNhapSelectAllBySoPN]
GO

/******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:					Description:
**		--------	--------				-----------------------------------
**		14/06/2012	SongTM					Innit created
*******************************************************************************/

CREATE PROCEDURE [dbo].[spChiTietPhieuNhapSelectAllBySoPN]
(
	@SoPN nvarchar(14)
)
WITH ENCRYPTION

AS

SET NOCOUNT ON

SELECT 
	[tbl_ChiTietPhieuNhap].MaCTPN,
	[tbl_ChiTietPhieuNhap].SoPN,
	[tbl_ChiTietPhieuNhap].SoLuong,
	[tbl_ChiTietPhieuNhap].DonGia,
	tbl_LuuKho.*
FROM [tbl_ChiTietPhieuNhap] INNER JOIN tbl_LuuKho ON tbl_LuuKho.MaLuuKho=tbl_ChiTietPhieuNhap.MaLuuKho
WHERE [SoPN] = @SoPN
GO

--GRANT EXECUTE ON [dbo].[spChiTietPhieuNhapSelectAllBySoPN] TO [sa]
--GO
